package com.xiangxiao.rpan.data.service.impl;

import com.xiangxiao.rpan.data.exception.DataException;
import com.xiangxiao.rpan.data.mapper.AlarmInfoMapper;
import com.xiangxiao.rpan.data.model.*;
import com.xiangxiao.rpan.data.service.AlarmInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Projectname: rpan-data
 * @Author: xiangxiao
 * @Email: 573768011@qq.com
 * @Data:2024/6/3 0:52
 */
@Slf4j
@Service
public class AlarmInfoServiceImpl implements AlarmInfoService {
  @Autowired
  private AlarmInfoMapper alarmInfoMapper;
  @Override
  public Integer insertFileUploadAlarm(FileUploadAlarm alarm) {
    Integer id = null;
    try {
      id = alarmInfoMapper.insertFileUploadAlarm(alarm);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return id;
  }

  @Override
  public Integer insertFloderUploadAlarm(FloderUploadAlarm alarm) {
    Integer id = null;
    try {
      id = alarmInfoMapper.insertFloderUploadAlarm(alarm);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return id;
  }

  @Override
  @Transactional
  public Integer insertFileDownloadAlarm(FileDownLoadAlarm alarm) {
    Integer id = null;
    try {
      id = alarmInfoMapper.insertFileDownloadAlarm(alarm);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return id;
  }

  @Override
  public Integer insertFloderDownloadAlarm(FloderDownloadAlarm alarm) {
    Integer id = null;
    try {
      id = alarmInfoMapper.insertFloderDownloadAlarm(alarm);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return id;
  }
}
